package com.example.demo.tokenbucket;

import com.example.demo.redis.RedisUtil;
import jakarta.annotation.Resource;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("/token/bucket")
public class TokenBucket2Controller {
    @Resource
    RedisUtil redisUtil;

    @SneakyThrows
    @GetMapping("/flow/control-2")
    @RequireToken
    public String flowControl() {
        return "抢到令牌，可以执行";
    }
}
